#include <iostream>
using std::cout;
using std::endl;

class Complex{
public:
    Complex(double real,double image)
    : _real(real)
    , _image(image)
    {
        cout << "Complex(double,double)" << endl;
    }

    void print() const{
        cout << _real << " + " << _image << "i" << endl;
    }

    //运算符重载之成员函数
    Complex operator+(const Complex & rhs){
        cout << "Complex 成员函数 +" << endl;
        return Complex(_real + rhs._real,
                       _image + rhs._image);
    }

    Complex & operator++(){
        cout << "Complex的前置++" << endl;
        ++_real;
        ++_image;
        return *this;
    }

    Complex operator++(int){
        cout << "Complex的后置++" << endl;
        Complex tmp(*this);
        ++_real;
        ++_image;
        return tmp;
    }
private:
    double _real;
    double _image;
};


void test0(){
    int a = 1;
    //&(a++);//返回的是一个临时变量
    &(++a);

    Complex c1(2,3);
    ++c1;
    c1.print();
    c1++;
    c1.print();
}

int main(void){
    test0();
    return 0;
}
